Skip to content

fix: ignore nested kind attribute in multi-kind context conversion - #72

Merged
kinyoklion merged 1 commit into
mainfrom
devin/1794994888-ignore-nested-kind
Nov 18, 2026
Merged

kinyoklion merged 1 commit into
mainfrom
devin/1794994888-ignore-nested-kind

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Same fix as launchdarkly/openfeature-php-server#39; the Python provider already behaves this way.

Describe the solution you've provided

In a multi-kind evaluation context, the sub-context's kind comes from its top-level attribute name (OFP Req 2.2.1 / 2.4.1). EvaluationContextConverter skipped only key/targetingKey when copying a sub-context's attributes, so a nested kind (e.g. org: { kind: "user", key: ... }) overwrote the sub-context's kind and could produce an invalid context. The converter now also skips kind there.

Tests cover a nested kind equal to another kind ("user"), kind: "multi", and a non-string kind (42). Each one checks that the result is a valid two-kind context, that the org sub-context keeps kind org, and that kind is not a custom attribute. The existing single-context kind tests pass unchanged.

Describe alternatives you've considered

Logging a warning for a nested kind. Not done, to match the PHP and Python providers.

Additional context

./gradlew build and jacocoTestReport pass locally (66 tests).


OpenFeature Maintainer opened this PR for Ryan
Implemented in session Ignore nested kind in Java multi-context conversion
Review with Devin · Open in Devin Desktop



Note

Overview
Fixes multi-kind OpenFeature → LaunchDarkly conversion when a sub-context (e.g. org) incorrectly includes a nested kind attribute alongside key.

EvaluationContextConverter.BuildSingleContext already ignored key and targetingKey when copying attributes; it now also skips kind, since sub-context kind is defined by the top-level attribute name in a kind: multi context. That prevents a nested kind (wrong string, "multi", or non-string) from corrupting the built LDContext or landing in custom attributes.

A new test itIgnoresNestedKindInMultiKindContexts checks string and non-string nested kind values and asserts a valid two-kind result with org staying kind org and no kind custom attribute, with no error logs.

Reviewed by Cursor Bugbot for commit 0a428fe. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@kinyoklion
kinyoklion marked this pull request as ready for review November 18, 2026 21:19
@kinyoklion
kinyoklion requested a review from a team as a code owner November 18, 2026 21:19
@cursor cursor Bot added the risk:low label Nov 18, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: low.

Automated risk review (dry run): Low

This PR would be automatically approved.

Why: Narrow skip of nested kind in EvaluationContextConverter for multi-kind contexts, with matching tests in ContextConverterTest. Cursor Bugbot completed with no findings.

If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

@kinyoklion
kinyoklion merged commit 15a6086 into main Nov 18, 2026
12 checks passed
@kinyoklion
kinyoklion deleted the devin/1794994888-ignore-nested-kind branch November 18, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants